<template>
	<div class="Ipt">
		<div class="Ipt-Input" :style="{paddingLeft:padding + 'px'}">
			<div class="Ipt-Num">{{Num|NumInti(filter)}}</div>
			<div class="Ipt-Gb" v-show="GbStu"></div>
			<div class="Ipt-Pl" :style="{left:padding + 'px'}" v-show="!GbStu&&Num.length<1">
				<span v-if="!filter">请输入认购额度</span>
				<span v-else>请输入银行卡号</span>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		name: 'Ipt',
		data() {
			return {
				padding: '40',
				Num: '',
				GbStu: false,
				filter: false
			}
		},
		methods: {

		},
		mounted() {
			var vm = this;
			this.bus.$on('NumData', function(NumData) {
				vm.Num = NumData;
			});
			this.bus.$on('DelS', function(Number) {
				if(Number == 1) {
					vm.Num = vm.Num.substring(0, parseInt(vm.Num.length) - 1)
				}
			})
		},
		filters: {
			NumInti: function(value, Stu) {
				if(Stu) {
					value = value.replace(/\s/g, '').replace(/\D/g, '').replace(/(\d{4})(?=\d)/g, "$1 ");
					return value
				} else {
					
					return value;
				}
			}
		}
	}
</script>

<style scoped="scoped">
	.Ipt {
		width: 100%;
		height: 100%;
	}
	
	.Ipt-Input {
		width: 100%;
		height: 100%;
		border-radius: 8px;
		box-sizing: border-box;
		box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
		-webkit-appearance: none;
		border: 2px solid #DADADA;
		display: flex;
		align-items: center;
		justify-content: flex-start;
		position: relative;
	}
	
	.Ipt-Gb {
		width: 3px;
		height: 60%;
		background-color: #D2D2D2;
		animation: ss 1s linear infinite;
	}
	
	.Ipt-Num {
		font-size: 36px;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}
	.Ipt-Pl
	{
		position: absolute;
		font-size: 30px;
		color: #c2c2c2;
	}
	
	@keyframes ss {
		from {
			opacity: 0;
		}
		to {
			opacity: 1;
		}
	}
</style>